#include "person.h"

const string & user::getId() const{
	return this->id;
}

const string & user::getName() const{
	return this->name;
}

const string & user::getPassword() const{
	return this->password;
}

const string & user::getIntro() const{
	return this->intro;
}

const vector<string>& user::getFocusList() const{
	return this->focusList;
}

const vector<unsigned>& user::getInterests() const{
	return this->interest;
}

const unsigned user::getQuestionNum() const
{
	return this->questionNum;
}

const unsigned user::getAnswerNum() const
{
	return this->answerNum;
}

void user::setName(const string & p_name){
	this->name.assign(p_name);
}

void user::setPassword(const string & p_password){
	this->password.assign(p_password);
}

void user::setIntro(const string & p_intro){
	this->intro.assign(p_intro);
}

void user::addToFocus(const string & p_question){
	this->focusList.push_back(p_question);
}

void user::deleteFromFocus(const string & p_question){
	auto iter = find_if(this->focusList.begin(), this->focusList.end(), [p_question](const string& a) -> bool {return a == p_question; });
	this->focusList.erase(iter);
}

void user::addToInterests(const unsigned p_interests){
	this->interest.push_back(p_interests);
}

void user::deleteFromInterests(const unsigned p_interests){
	auto iter = std::find_if(this->interest.begin(), this->interest.end(), [p_interests](const unsigned a)-> bool {return a == p_interests; });
	this->interest.erase(iter);
}
